# Contributor: Duncan Bellamy <dunk@denkimushi.com>
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=snowball
pkgver=2.2.0
pkgrel=0
pkgdesc="Snowball rule-based stemming algorithms"
url="https://snowballstem.org/"
arch="all"
license="BSD-3-Clause"
makedepends="perl"
subpackages="$pkgname-doc libstemmer:_libstemmer libstemmer-dev:_libstemmerdev"
source="$pkgname-$pkgver.tar.gz::https://github.com/snowballstem/snowball/archive/refs/tags/v$pkgver.tar.gz
	libstemmer-library.patch"

build() {
	make
}

check() {
	#check_utf8 check_iso_8859_1 check_iso_8859_2 check_koi8r
	#all have missing sub-targets
	make check_stemtest
}

package() {
	install -d "$pkgdir"/usr/bin "$pkgdir"/usr/lib "$pkgdir"/usr/include
	install snowball stemwords "$pkgdir"/usr/bin
	install libstemmer.a "$pkgdir"/usr/lib
	install include/libstemmer.h "$pkgdir"/usr/include
	install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

_libstemmer() {
	install -d "$subpkgdir"/usr/lib
	install "$builddir"/libstemmer.so.* "$subpkgdir"/usr/lib
}

_libstemmerdev() {
	pkgdesc="Header files and development libraries for libstemmer"
	default_dev
	mv "$builddir"/libstemmer.so $subpkgdir/usr/lib
}
sha512sums="
02c43313de9de2518ea51cfb11f1c29145fc046c7838329bfdefd70b604009ad44b6db8175c25b0db31f03db30a6aec5857aa35775a9c204ec976df9cae62957  snowball-2.2.0.tar.gz
6e8976313c91b71a13e50c213b74cc037ff794bf38451e1a053813c00b963527c6ff1f7baece1645f15a38bce893c4484247f71a945275276cb7aa16a1414817  libstemmer-library.patch
"
